/*
 * $Id: MapPropertiesAction.java 24 2009-03-31 23:40:10Z aaron.day $
 */
package org.crazydays.gameplan.map.swing.event;


import java.awt.event.ActionEvent;

import javax.swing.AbstractAction;
import javax.swing.Icon;

import org.crazydays.gameplan.map.IGameMap;
import org.crazydays.gameplan.map.swing.JMapPropertiesDialog;

/**
 * MapPropertiesAction
 */
public class MapPropertiesAction
        extends AbstractAction
{
	/** serial version uid */
	public final static long serialVersionUID =
	        "$Id: MapPropertiesAction.java 24 2009-03-31 23:40:10Z aaron.day $"
	                .hashCode();

	/** game map */
	protected IGameMap gameMap;

	/**
	 * MapPropertiesAction constructor.
	 * 
	 * @param name Name
	 * @param gameMap Game map
	 */
	public MapPropertiesAction(String name, IGameMap gameMap)
	{
		super(name);
		setGameMap(gameMap);
	}

	/**
	 * MapPropertiesAction constructor.
	 * 
	 * @param name Name
	 * @param icon Icon
	 * @param gameMap Game maps
	 */
	public MapPropertiesAction(String name, Icon icon, IGameMap gameMap)
	{
		super(name, icon);
		setGameMap(gameMap);
	}

	/**
	 * Set game map.
	 * 
	 * @param gameMap Game map
	 */
	public void setGameMap(IGameMap gameMap)
	{
		this.gameMap = gameMap;
	}

	/**
	 * Get game map.
	 * 
	 * @return Game map
	 */
	public IGameMap getGameMap()
	{
		return gameMap;
	}

	/**
	 * Open map properties dialog.
	 * 
	 * @param e Event
	 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
	 */
	public void actionPerformed(ActionEvent e)
	{
		JMapPropertiesDialog dialog =
		        new JMapPropertiesDialog(getGameMap());
		dialog.setVisible(true);
	}
}
